package edu.suda.xsap.controller;

import edu.suda.xsap.dto.CardDto;
import edu.suda.xsap.service.CardService;
import edu.suda.xsapadminutils.common.Result;
import edu.suda.xsapadminvo.CardVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/card")
public class CardController {
    @Autowired
    private CardService cardService;

    @PostMapping("/save")
    public Result save(@RequestBody CardVO cardVO) {
        return cardService.save(cardVO);
    }

    @PostMapping("/update")
    public Result update(@RequestBody CardVO cardVO) {
        return cardService.update(cardVO);
    }

    @GetMapping("/findAll")
    public List<CardDto> findAll() {
        return cardService.findAll();
    }

}
